//
//  DHNavbarView.m
//  精品酒店
//
//  Created by DIANGHONG on 2018/5/9.
//  Copyright © 2018年 DIANGHONG. All rights reserved.
//

#import "DHNavbarView.h"
@interface DHNavbarView()
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UIButton *returnButton;

@end
@implementation DHNavbarView

+ (instancetype)navbarViewWithFrame:(CGRect)frame title:(NSString *)title isHiddenReturn:(BOOL)isHiddenReturn
{
    UINib *nib = [UINib nibWithNibName:@"DHNavbarView" bundle:nil];
    
    DHNavbarView *navbar = [nib instantiateWithOwner:nil options:nil][0];
    navbar.frame = frame;
    navbar.title.text = title;
    navbar.returnButton.hidden = isHiddenReturn;
    return navbar;
}

- (void)awakeFromNib{
    [super awakeFromNib];
    [self.returnButton addTarget:self action:@selector(popButtonClick) forControlEvents:UIControlEventTouchUpInside];

}

- (void)popButtonClick{
    NSAssert(self.popButtonClickBlock != nil, @"self.popButtonClickBlock 不能为nil");
    
    self.popButtonClickBlock();
}

@end
